package io.renren.modules.generator.service.impl;

import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;

import io.renren.modules.generator.dao.BsnStudentDao;
import io.renren.modules.generator.entity.BsnStudentEntity;
import io.renren.modules.generator.service.BsnStudentService;


@Service("bsnStudentService")
public class BsnStudentServiceImpl extends ServiceImpl<BsnStudentDao, BsnStudentEntity> implements BsnStudentService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        Page<BsnStudentEntity> page = this.selectPage(
                new Query<BsnStudentEntity>(params).getPage(),
                new EntityWrapper<BsnStudentEntity>()
        );

        return new PageUtils(page);
    }
    
    @Override    
    public PageUtils queryPage(Map<String, Object> params, Wrapper<BsnStudentEntity> wrapper) {
        Page<BsnStudentEntity> page = this.selectPage(
                new Query<BsnStudentEntity>(params).getPage(),
                wrapper
        );

        return new PageUtils(page);
    }
    
    @Override
    public BsnStudentEntity selectByLoginId(String loginId) {
    	BsnStudentEntity entity = new BsnStudentEntity();
    	entity.setLoginId(loginId);
    	return baseMapper.selectOne(entity);
    }
}
